package com.only.common.util.ssh;

import lombok.Data;

@Data
public class CmdExecuteResult {
    /**
     * 是否成功
     */
    private boolean successful;

    /**
     * 指令执行原生状态码， 0 成功， 其它失败, -1 执行异常，如无法链接服务器等
     */
    private int status;

    /**
     * 执行日志信息
     */
    private String executeLog;

    public CmdExecuteResult(boolean successful, int status, String executeLog) {
        this.successful = successful;
        this.status = status;
        this.executeLog = executeLog;
    }

    public boolean isFail() {
        return !successful;
    }

    @Override
    public String toString() {
        return "CmdExecuteResult{" +
                "successful=" + successful +
                ", status=" + status +
                ", executeLog='" + executeLog + '\'' +
                '}';
    }
}
